package main

import (
	"fmt"
	"net"
)

func main() {
	host := "192.168.16.154"
	// 用于解析 IP格式是否正常
	ip := net.ParseIP(host)
	fmt.Println(ip)

	fmt.Printf("IP: %s %s\n", ip, ip.String())
	// 获取该地址的默认子网掩码
	defaultMask := ip.DefaultMask()
	fmt.Printf("DefaultMask: %s %s\n", defaultMask, defaultMask.String())

	network := net.IPv4(192, 168, 16, 154)
	fmt.Println(network.DefaultMask())
}
